﻿using System;
using System.Collections;
using System.Collections.Generic;

namespace Wp7Tools.Controls {
    public class GroupedItems<T> : IEnumerable<T> {

        public string Label { get; set; }
        public IList<T> Items { get; set; }

        public GroupedItems(string name, IEnumerable<T> items) {
            Label = name;
            Items = new List<T>(items);
        }

        public override bool Equals(object obj) {
            GroupedItems<T> that = obj as GroupedItems<T>;
            return (that != null) && (Label.Equals(that.Label));
        }

        public IEnumerator<T> GetEnumerator() {
            return Items.GetEnumerator();
        }
        
        IEnumerator IEnumerable.GetEnumerator() {
            return Items.GetEnumerator();
        }
    }
}
